﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ReportMealManagementSystem.Tool
{
    public class ValueVerify
    {
        /// <summary>
        /// 手机号码验证
        /// </summary>
        /// <param name="str_handset">手机号码</param>
        /// <returns></returns>
        public bool IsHandset(string str_handset)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(str_handset, @"^[1]+[3,5,7,8,9]+\d{9}");
        }

        /// <summary>
        /// 电话号码验证
        /// </summary>
        /// <param name="str_telephone">电话号码</param>
        /// <returns></returns>
        public bool IsTelephone(string str_telephone)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(str_telephone, @"^(\d{3,4}-)?\d{6,8}$");
        }

        /// <summary>
        /// 身份证号码验证
        /// </summary>
        /// <param name="str_idcard">身份证号码</param>
        /// <returns></returns>
        public bool IsIDcard(string str_idcard)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(str_idcard, @"(^\d{18}$)|(^\d{15}$)");
        }

        /// <summary>
        /// 数字验证
        /// </summary>
        /// <param name="str_number">数字</param>
        /// <returns></returns>
        public bool IsNumber(string str_number)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(str_number, @"^[0-9]*$");
        }

        /// <summary>
        /// 邮政编码验证
        /// </summary>
        /// <param name="str_postalcode">邮政编码</param>
        /// <returns></returns>
        public bool IsPostalcode(string str_postalcode)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(str_postalcode, @"^\d{6}$");
        }
    }
}
